package br.com.zanictech.grails.broker

import grails.converters.JSON
import ajax.AjaxResponse

class ServidorController {

	static navigation = true
	
    def scaffold = Servidor
	def servidorService
	
	def startstop = {
		AjaxResponse resposta = new AjaxResponse()
		
		def servidor = servidorService.startstop(params.servidorId, params.opcao)
		
		if(servidor) {
			resposta.statusCode = AjaxResponse.STATUS_OK
			resposta.data = g.render(template: 'list', model: [ servidorInstanceList: Servidor.list()])
			render resposta as JSON
		}
	}
}